package com.lm.framework.adapater;


import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;

import com.lm.utils.Tools;
import com.lm.utils.page.PageBean;

public abstract class LmBaseAction{
	
	private static final long serialVersionUID = 5743628840067613183L;

	protected LmBaseService service;
	
	protected PageBean pageBean;
	
	public void setPageBean(PageBean pageBean) {
		this.pageBean = pageBean;
	}


	public PageBean getPageBean() {
		if(pageBean==null){
			pageBean=new PageBean();
		}
		HttpServletRequest request = ServletActionContext.getRequest();
		if (Tools.isNotNullOrEmpty(request.getParameter("curPage"))) {
			pageBean.setPage(
					Integer.parseInt(request.getParameter("curPage")));
		}
		if (Tools.isNotNullOrEmpty(request.getParameter("pagesize"))) {
			pageBean.setPageSize(
					Integer.parseInt(request.getParameter("pagesize")));
		}
		return pageBean;
	}


	public void setService(LmBaseService service) {
		this.service = service;
	}
}